package com.greenline.push.service.core.counter;

import java.util.concurrent.ConcurrentHashMap;

import com.greenline.push.service.core.ProcessQueueList;

public class CounterManager {
    private ConcurrentHashMap<String, ProcessQueueList> queueMap = new ConcurrentHashMap<String, ProcessQueueList>();

    public void addQueue(String queueName, ProcessQueueList queue) {
        queueMap.putIfAbsent(queueName, queue);
    }

    public ConcurrentHashMap<String, ProcessQueueList> getQueueMap() {
        return queueMap;
    }

    public void setQueueMap(ConcurrentHashMap<String, ProcessQueueList> queueMap) {
        this.queueMap = queueMap;
    }

    //
    // @Resource
    // private ThrottleManger throttle;
    // private List<CounterInstance> counterList = null;
    // private static ScheduledThreadPoolExecutor schedule = new
    // ScheduledThreadPoolExecutor(6);

    // public CounterManager() {
    // // this.counterList = list;
    // schedule = ;
    // }

    // public void insertToSchedule(CounterInstance counter) {
    // // 每秒统计一次
    // schedule.scheduleAtFixedRate(new runCount(counter), 0, 1,
    // TimeUnit.SECONDS);
    // }

    // static class runCount implements Runnable {
    // private CounterInstance counter;
    //
    // public runCount(CounterInstance count) {
    // this.counter = count;
    // }
    //
    // @Override
    // public void run() {
    // // 调用了多少次
    // counter.log();
    // // 数据清零
    // counter.reset();
    // }
    // }
}
